package com.app.controller;

import cn.dev33.satoken.stp.StpUtil;
import com.app.common.TotalConfig;
import com.app.service.IUserService;
import com.app.util.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/adminUserManagement")
@Api(tags = "admin小程序用户管理接口")
public class AdminUserManagementController {
    @Autowired
    private IUserService userService;


    @ApiOperation(value = "小程序用户列表")
    @GetMapping("/miniUserList")
    public Result<Object> miniUserList(Integer page, Integer limit,String keyword) {
        return userService.miniUserList(page,limit,keyword);
    }

    /**
     * 用户详情和用户交过费的账号
     * @param userId
     * @return
     */
    @ApiOperation(value = "用户详情_基本信息")
    @GetMapping("/basicDetails")
    public Result<Object> basicDetails(Integer userId) {
        if (!StpUtil.hasPermission("admin:user:detail")){
            return Result.error(TotalConfig.NO_PERMISSION);
        }
        return userService.basicDetails(userId);
    }


    @ApiOperation(value = "用户详情中_户号缴费记录的分页列表查询")
    @GetMapping("/householdDetails")
    public Result<Object> householdDetails(String account,Integer page,Integer limit,Integer userId) {
        return userService.householdDetails(account,page,limit,userId);
    }
}
